package com.xplay.xpocker.constant;

import com.xplay.xpocker.room.mahjong.dto.RuleConstant;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public enum RoomTypeEnum {
    DEFAULT(RoomTypeParent.Mahjong, "DEFAULT", "默认规则"),
    WZ_MAHJONG(RoomTypeParent.Mahjong, "WZ_MAHJONG", "万州麻将"),
    CD_MAHJONG(RoomTypeParent.Mahjong, "CD_MAHJONG", "成都麻将");

    static {
        RULE_CACHE = Arrays.stream(RoomTypeEnum.values()).collect(Collectors.toMap(RoomTypeEnum::getCode, Function.identity()));
    }

    public static final Map<String, RoomTypeEnum> RULE_CACHE;
    public int parent;
    public String code;
    public String name;


    public static RoomTypeEnum of(String type) {
        return RULE_CACHE.get(type);
    }

    RoomTypeEnum(int parent, String code, String name) {
        this.parent = parent;
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getParent() {
        return parent;
    }

    public void setParent(int parent) {
        this.parent = parent;
    }
}
